package ltd.hanamaki.unittest.testng.parameter;

/**
 * 三角形的源代码
 */

/**
 * @author  hanamaki
 */
public class Triangle {

    private double a;
    private double b;
    private double c;
    private boolean isTriangle;

    public Triangle() {
    }

    public Triangle(int a, int b, int c, boolean isTriangle) {
        this.a = a;
        this.b = b;
        this.c = c;
        this.isTriangle = isTriangle;
    }


    public boolean isTriangle(int a, int b, int c) {
        if (a + b > c && a + c > b && b + c > a) {
            /* 计算 周长 和 面积  */
            return true;
        } else {
            return false;
        }
    }

    public double calcPerimeter() {
        return this.a + this.b + this.c;
    }

    public double calcArea() {
        /* 海伦公式 */
        return Math.sqrt(calcPerimeter() * (calcPerimeter() - a) * (calcPerimeter() - b) * (calcPerimeter() - c));
    }



}
